import orm from '@/api/orm'
export default {
  list() {
    return new Promise((resolve, reject) => {
      orm.list('Company').then(res => {
        const companies = res.data.data
        const companyArr = []
        const companyJson = {}
        for (const company of companies) {
          companyJson[company.id] = company
          companyArr.push({ label: company.name, value: company.id })
        }
        resolve({ array: companyArr, json: companyJson })
      }).catch(res => {
        reject(res)
      })
    })
  }
}
